<?php

use yii\helpers\Url;

$username = isset($loginUser->attributes["username"]) ? $loginUser->attributes["username"] : "";


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/js/ajax141212.js"></script>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<style>

.topnavbar{
    width:100%;
    height: 54px;
    background-color:#209e85;
}

/**
通过给父元素设置 font-size: 0; ，使空白符不可见。但会导致子元素中继承的字体大小也为 0
可以明确子元素内字体大小的，为其单独设置文字大小。
*/
.topnavbar .center{
    margin:0px auto; width:1000px; height:54px; font-size: 0px;
}

.topnavbar .center .item{
    display: inline-block;
    padding: 15px;
    font-size: 16px;
    height: 24px;
    line-height: 24px;
    color: #EEE;
}

.topnavbar .center .item a{
    color: #EEE;
    text-decoration:none;
}

.topnavbar .center .item a:hover{
    color: white;
}

</style>

<script language="javascript">
    (function(){
      //判断是手机浏览器
      var isMobileBrowser = function(){

        if(/Android|webOS|iPhone|iPod|iPad|BlackBerry|Windows CE|Windows Phone/i.test(navigator.userAgent)){
          if(window.location.href.indexOf("?pc")<0){
            try{
              return true;
            }catch(e){}
          }
        }
        return false;
      }

      if(isMobileBrowser()){
        var mroot = "http://m.recite.eedoc.cn";

        //window.location.href = mroot;
      }
    })();
</script>
</head>
<body>
<div class="topnavbar" style="margin-bottom: 10px;">
    <div class="center">
        <div class="item" style=""><a href="/">首页</a></div>
        <div class="item" style=""><a href="<?php echo Url::to(['/english/index']) ?>">词库管理</a></div>
        <div class="item"><a href="<?php echo Url::to(['/topic/index']) ?>">单词专题</a></div>
        <div class="item"><a href="<?php echo Url::to(['/random/index', 'refresh'=>true]) ?>">随机测试</a></div>
        <div class="item"><a href="<?php echo Url::to(['/practice/exchange']) ?>">知识交换</a></div>
        <div class="item"><a href="<?php echo Url::to(['/practice/index']) ?>">开始练习</a></div>
        <div class="item"><a href="<?php echo Url::to(['/practice/index', 'mobile' => 'true']) ?>">移动浏览</a></div>
        <div class="item"><a href="<?php echo Url::to(['/practice/understand']) ?>">理解模式</a></div>
        <div class="item"><a href="<?php echo Url::to(['/practice/understand', 'mobile' => 'true']) ?>">理解移动</a></div>
        <?php
        if(empty($username)){
            echo '<div class="item"><a href="'.Url::to(['/login/login']).'">登录</a></div>';
        }else{
            echo '<div class="item"><a href="">'.$username.'</a> <a href="'.Url::to(['/login/logout']).'">退出</a></div>';
        }
        ?>
    </div>
</div>


